home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / web / noweb / src / Makefile.nw < prev    next >
Makefile  |  1995-02-24  |  4KB  |  124 lines

  1. I got sick and tired of copying goo for multiple files.
  2. This nonsense is the result.  (Too bad mk isn't everywhere.)
  3. <<version>>=
  4. 2.7
  5. <<script>>=
  6. (cat Makefile.nw; echo ""; notangle -t8 -R'generate chunks' Makefile.nw | sh) | notangle -t8 -
  7. <<*>>=
  8. # Copyright 1995 by Norman Ramsey.  All rights reserved.
  9. # See file COPYRIGHT for more information.
  10. #
  11. # Adjust these two lines for your ANSI C compiler
  12. CC=gcc
  13. CFLAGS=
  14. # If you have Icon, you should use the Icon versions of the noweb pipeline.
  15. # Set LIBSRC=icon
  16. LIBSRC=awk
  17. # If you have no Icon compiler, but do have icont, make ICONC=icont
  18. ICONC=iconc
  19. ICONT=icont
  20.  
  21. # BIN is where the commands (notangle, noweave, nountangle, noroots) land
  22. # LIB is where the pieces of the pipes (nt, markup, unmarkup) are stored
  23. # MAN is the root of your local man pages directory
  24. # MANEXT is the extension for your commands' man pages (usually 1 or l)
  25. # TEXINPUTS is the directory for TeX macro files
  26. BIN=/usr/public/pkg/noweb/bin
  27. LIB=/usr/public/pkg/noweb/lib
  28. MAN=/usr/public/pkg/noweb/man
  29. MANEXT=1
  30. TEXINPUTS=/usr/public/pkg/tex/tex/inputs
  31.  
  32. # change WEAVE if you want a different version of noweave to be installed
  33. WEAVE=noweave        
  34.  
  35. # Stop editing.  No user-serviceable parts below.
  36. SHELL=/bin/sh
  37. NAME=version
  38. CIMSG=checked in with name $(NAME)
  39. MANDIR=$(MAN)/man$(MANEXT)
  40. CATDIR=$(MAN)/cat$(MANEXT)
  41. LIBNAME=$(LIB)
  42. TEXNAME=$(TEXINPUTS)
  43.  
  44. all:
  45.     cd c; make "CC=$(CC)" "CFLAGS=$(CFLAGS)" all 
  46.     cd lib; make all
  47.     cd xdoc; make all
  48.     cd $(LIBSRC); make "ICONT=$(ICONT)" "ICONC=$(ICONC)" all
  49.  
  50. install: install-code install-man install-tex
  51.  
  52. install-code:
  53.     -mkdir $(BIN) $(LIB) 2>/dev/null
  54.     strip c/nt c/markup c/mnt c/finduses
  55.     cp c/nt c/markup c/mnt c/finduses $(LIB)
  56.     cd $(LIBSRC); make ICONT=$(ICONT) ICONC=$(ICONC) LIB=$(LIB) BIN=$(BIN) install
  57.     cp lib/unmarkup lib/emptydefn $(LIB)
  58.     <<shell binaries>>
  59. <<generate chunks>>=
  60. echo '@<<shell binaries@>>='
  61. for i in noweb notangle '$(WEAVE)' nountangle nodefs noroots nuweb2noweb cpif
  62. do
  63.   echo 'sed "s@|LIBDIR|@$(LIBNAME)@"' "shell/$i" '> $(BIN)/'"$i"
  64.   echo 'chmod +x $(BIN)/'"$i"
  65. done
  66. <<*>>=
  67. install-man:
  68.     -mkdir $(MAN) $(MANDIR) 2>/dev/null
  69.     <<ordinary pages>>
  70. <<*>>=
  71. install-preformat-man:
  72.     -mkdir $(MAN) $(CATDIR) 2>/dev/null
  73.     <<preformatted compressed pages>>
  74. <<generate chunks>>=
  75. NORMALPAGES="cpif nodefs noroots noweb noindex nowebstyle nuweb2noweb nowebfilters notangle sl2h"
  76. LINKPAGES="noweave nountangle"
  77.  
  78. echo '@<<ordinary pages@>>='
  79.  
  80. for i in $NORMALPAGES; do
  81.   echo 'sed -e "s@|LIBDIR|@$(LIBNAME)@" -e "s@|TEXINPUTS|@$(TEXNAME)@"' \
  82.     "xdoc/$i.1" '> $(MANDIR)/'"$i"'.$(MANEXT)'
  83. done
  84.  
  85. for i in $LINKPAGES; do
  86.   echo 'rm -f $(MANDIR)/'"$i"'.$(MANEXT)'
  87.   echo '(cd $(MANDIR); ln notangle.$(MANEXT)' "$i"'.$(MANEXT))'
  88. done
  89.  
  90. echo '@<<preformatted compressed pages@>>='
  91.  
  92. for i in $NORMALPAGES; do
  93.   echo 'sed -e "s@|LIBDIR|@$(LIBNAME)@" -e "s@|TEXINPUTS|@$(TEXNAME)@"' \
  94.     "xdoc/$i.txt" ' | gzip > $(CATDIR)/'"$i"'.$(MANEXT).gz'
  95. done
  96.  
  97. for i in $LINKPAGES; do
  98.   echo 'rm -f $(CATDIR)/'"$i"'.$(MANEXT).gz'
  99.   echo '(cd $(CATDIR); ln notangle.$(MANEXT).gz' "$i"'.$(MANEXT).gz)'
  100. done
  101. <<*>>=
  102. install-tex:
  103.     -mkdir $(TEXINPUTS) 2>/dev/null
  104.     cp tex/nwmac.tex tex/noweb.sty $(TEXINPUTS)
  105.  
  106. checkin:
  107.     for i in lib tex; do (cd $$i; ci -l -n'$(NAME)' -m'$(CIMSG)' *); done
  108.     cd xdoc; ci -l -n'$(NAME)' -m'$(CIMSG)' *.nw *.tex
  109.     for i in c icon awk; do (cd $$i; ci -l -n'$(NAME)' -m'$(CIMSG)' *.nw Makefile); done
  110.     ci -l -n'$(NAME)' -m'$(CIMSG)' Makefile INSTALL README COPYRIGHT nwmake *.nw
  111.  
  112. source: ;    for i in c shell lib xdoc icon awk tex; do (cd $$i; make source); done
  113. clean:
  114.     for i in c  shell lib xdoc icon awk tex; do (cd $$i; make clean); done
  115.     rm -f nwsrcfilter *~ */*~
  116.  
  117. veryclean: clean
  118.     for i in c lib icon awk; do (cd $$i; make veryclean); done
  119.  
  120. Makefile: Makefile.nw
  121.     chmod +w Makefile
  122.     notangle -R'script' Makefile.nw | sh > Makefile
  123.     chmod -w Makefile
  124.